<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%@include file="/view/common/head.jsp" %>
    <link rel="stylesheet" href="static/css/manager.css">
    <link rel="stylesheet" href="static/css/book_manager.css">
    <script src="/static/js/book_manager.js"></script>
    <title>图书管理页面</title>

    <script type="text/javascript">
        $(function () {
            $("a.delete_book").click(function () {
                return confirm("您确定要删除" + $(this).parent().parent().find("td:first").text() + "这本书吗");
            })
        })
    </script>
</head>
<body>
<div class="header">
    <div class="top">
        <div class="left_top">
            <img src="static/image/logo.jpeg" alt="">
            <span>图书管理系统</span>
        </div>
        <%@ include file="/view/common/manager_menu.jsp" %>
    </div>
</div>
<div class="main">
    <table class="show_body">
        <thead>
        <tr>
            <th>名称</th>
            <th>价格</th>
            <th>作者</th>
            <th>销量</th>
            <th>库存</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${requestScope.page.items}" var="book">
        <tr>
            <td>${book.name}</td>
            <td>${book.price}</td>
            <td>${book.author}</td>
            <td>${book.sales}</td>
            <td>${book.stock}</td>
            <td class="handle">
                <div>
                <a href="manager/bookServlet?action=getBook&id=${book.id}&pageNo=${requestScope.page.pageNo}">修改</a>
                <a class="delete_book" href="manager/bookServlet?action=delete&id=${book.id}">删除</a>
                </div>
            </td>
        </tr>
        </c:forEach>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="6">
                    <a href="view/manager/book_add.jsp?pageNo=${requestScope.page.pageTotal}">添加图书</a>
                </td>
            </tr>
        </tfoot>
    </table>
    <%@include file="/view/common/page_nav.jsp"%>
</div>
<%@include file="/view/common/footer.jsp" %>
</body>
</html>
